package com.cos.lession78mp.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;

import java.util.Date;

/**
 * @author: COS
 * @time: 2022/10/11 9:49
 * @description:
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
@ToString
@TableName("e_user") //设置要映射的表名
// Mybatis-plus 默认设置了下划线转为驼峰   SysUser->sys_user   包括字段属性也是一样
public class SysUser {
    // 设置表的主键
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    private String name;
    @TableField
    private Integer age;
    private String email;
    @TableField(value = "bornDate")  // 设置字段名的映射
    private Date bornDate;
    @TableField(exist = false)  //这个属性并不是对应数据库表的字段
    private Address address;
    public SysUser(String name, Integer age, String email) {
        this.name = name;
        this.age = age;
        this.email = email;
    }

    public SysUser(Long id, String name, Integer age, String email, Date bornDate) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.email = email;
        this.bornDate = bornDate;
    }
}
